<template>
  <nav>
    <!-- <router-link to="/Index">Home</router-link> |
    <router-link to="/login">About</router-link>-->
  </nav>
  <router-view />
</template>

<script>
export default {
  created() {
    const store = this.$store;
    window.onbeforeunload = function () {
      const { tags, userModule } = store.state;
      sessionStorage.setItem("tagList", JSON.stringify(tags.dynamicTag));
      sessionStorage.setItem("getId", tags.id);
      sessionStorage.setItem("userModule", JSON.stringify(userModule));
    };
  },
  mounted() {
    const store = this.$store;
    let tagList = sessionStorage.getItem("tagList");
    let userModule = sessionStorage.getItem("userModule")
    let getId = sessionStorage.getItem("getId");
    if(tagList){
      store.state.tags.dynamicTag = JSON.parse(tagList)
    }
    if(userModule){
      Object.assign(store.state.userModule,JSON.parse(userModule))
    }
    if(getId){
      store.state.tags.id = getId
    }
    sessionStorage.removeItem("tagList")
    sessionStorage.removeItem("userModule")
    sessionStorage.removeItem("getId")
  },
};
</script>
<style lang="less">
body {
  margin: 0;
  padding: 0;
}
</style>
